<%@page import="com.AO.DAO.FoodMenu"%>
<%@ page language="java" import="java.util.*" import="com.AO.DAO.*" pageEncoding="utf8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String id=(String)request.getAttribute("FoodInMenuId");
request.removeAttribute("FoodInMenuId");
FoodMenuDAO daom=new FoodMenuDAO();
FoodMenu menu=daom.findById(id);
%>
<!DOCTYPE html>
<html  class=""><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  

<title>
   <%=menu.getMenuName() %>    
</title>
    <link  href="./files/favicon.ico"  rel="shortcut icon"  type="image/x-icon">
  

<link  href="./files/base.d706c3c6.compress.css"  rel="stylesheet"  type="text/css">



<link  href="./files/other.0b3c792c.compress.css"  rel="stylesheet"  type="text/css">



<body  style="">



<div  class="popup-layer">


  
  <div  class="reveal-modal-bg"></div>
  

  
<div  class="reveal-modal large normal-font"  id="feedbackModal">
  
  <div  class="reveal-modal-title-bar">
    <div  class="reveal-modal-title">意见反馈</div>
    <a  href="javascript:void(0)"  class="close-reveal-modal"  rel="nofollow"></a>
  </div>
  <div  class="reveal-modal-main">
    

  
  </div>

</div>



</div>

<div  class="topbar-outer">
  <div  class="topbar-container">
    <div  class="topbar">
      



  <div  class="pure-g">
    <div  class="pure-u-1-6">
      <a  href="/foodfood/AOHomePage..action" class="logo"><img src="./files/logo.png"></a>
    </div>
    <div  class="pure-u-5-6">
      <div  class="pure-g">
        <div  class="pure-u-11-24">
          <form class="search" action="/foodfood/Search.action">
                                 <input type="text" name="keyword" class="typeahead float-left" data-default-text="" value="" placeholder="菜谱、食材">
                                 <input type="hidden" name="type" value="fmf">
                                 <input type="submit" value="搜索" class="button float-left">
                                </form>
        </div>
        <div  class="pure-u-1-3">
          <ul  class="site-nav plain pure-g">
            <li  class="pure-u"><a  href="/foodfood/AOHomePage..action"  data-ga-event="公共页面/导航栏/$text">首页</a></li>
            <li  class="topbar-cats pure-u">
            <a  href="/foodfood/AOMenu..action"  class="block-link"  data-ga-event="公共页面/导航栏/$text"><span>菜谱分类</span></a>
            	<%MaterialFoodTypesDAO dao=new MaterialFoodTypesDAO();
									FoodTypesDAO daof=new FoodTypesDAO();
									List<MaterialFoodTypes>list=dao.findByMaterialFoodTypeLevel(1);
									List<FoodTypes>listf=daof.findByFoodTypeLevel(1); 
									MaterialFoodOfSeasonDAO dao5=new MaterialFoodOfSeasonDAO();
									List<MaterialFoodOfSeason>list5=dao5.findAll();%>
										<div class="topbar-cats-submenu hidden">
											<div class="topbar-cats-submenu-bg">

												<ul class="plain">
													<li class="topbar-cat-head">常用主题</li>
													<% int k=0;for(FoodTypes ft:listf)
								                    {if(k++==8)break;%>
													<li><a
														href="/foodfood/AOFoodMenu.<%=ft.getFoodTypeId() %>.action"
														title="<%=ft.getFoodTypeName() %>菜谱大全" data-ga-event="公共页面/导航栏/$text"><%=ft.getFoodTypeName() %></a>
													</li>
													<%} %>
												</ul>
												<ul class="plain">
												   <li class="topbar-cat-head">常见食材</li>
												   <% k=0;for(MaterialFoodTypes ft:list)
								                    {if(k++==8)break;%>													
													<li><a href="/foodfood/AOMfoodMenu.<%=ft.getMaterialFoodTypeId() %>.action"
														title="<%=ft.getMaterialFoodTypeName() %>做法大全" data-ga-event="公共页面/导航栏/$text"><%=ft.getMaterialFoodTypeName() %></a>
													</li>
												   <%} %>
												</ul>
												<ul class="plain">
													<li class="topbar-cat-head">时令食材</li>
													<%k=0;for(MaterialFoodOfSeason mfos:list5)						    
									               {if(k++==8)break;%>
													<li><a href="/foodfood/AOMfood.<%=mfos.getMaterialFood().getMaterialFoodId() %>.action"
														title="<%=mfos.getMaterialFood().getMaterialFoodName() %>做法大全" data-ga-event="公共页面/导航栏/$text"><%=mfos.getMaterialFood().getMaterialFoodName() %></a>
												   <%} %>
												</ul>
												<div class="topbar-cats-submenu-bottom">
													<a href="/foodfood/AOMenu..action"
														data-ga-event="公共页面/导航栏/$text">查看全部分类</a>
												</div>

											</div>
										</div>
            </li>
            <li  class="pure-u"><a  href="/foodfood/AOFoodInMenuList..action"  data-ga-event="公共页面/导航栏/$text">菜单</a></li>
            
          </ul>
        </div>
        <div  class="pure-u-5-24 clearfix">

          			 <div class="user-action">
						              <%
											String account = (String)session.getAttribute("account");
											String nickname = (String)session.getAttribute("nickname");
										    	
							              	if(nickname!=null)
							           		{
										%>
										<a href="/foodfood/AOCooker.<%=account%>.action"><%=nickname%></a>
										<a onclick="logout()" href="index.jsp">退出</a>
										<%
											}
							               	else
							               	{
										%>
										<a href="register.jsp" data-ga-event="公共页面/导航栏/$text">注册</a> <a
											href="login.jsp" data-ga-event="公共页面/导航栏/$text">登录</a>&nbsp;&nbsp;
										<%
											}
										%>
						
						          </div>
        </div>
      </div>
    </div>
  </div>


    </div>
  </div>
</div>


<div  class="page-outer">
  
  <div  class="page-container">
    
      <div  class="pure-g">
        
        <div  class="pure-u-2-3 main-panel">
          

<div  class="block block-has-padding white-bg rl-show">
<div  class="rl-summary block block-has-padding block-bg block-negative-margin small-font">
  <h1  class="page-title align-center"><%=menu.getMenuName() %></h1>
  <div  class="stats align-center gray-font">
    718&nbsp;收藏
  </div>
  <img alt="" src="<%=menu.getImg() %>" style="width:500px;height:360px;">
  <div  class="desc">
     
      <%=menu.getDescription() %>
  </div>
  <div  class="pure-g">
    <div  class="pure-u-1-2">
      <a  href="/foodfood/AOCooker.<%=menu.getUser().getAccount()%>.action"  class="avatar-link">
        <img  src="<%=menu.getUser().getImg() %>"  alt="<%=menu.getUser().getNickName() %>"  width="30"  height="30">&nbsp;<%=menu.getUser().getNickName() %>
      </a>
    </div>
    <div  class="pure-u-1-2 align-right">
        <a  href="/foodfood/AOHomePage..actionauth/login/?path=/recipe_list/101611479/"  class="button large-button"  rel="nofollow">收藏</a>
    </div>
  </div>
  <div  class="pure-g time">
    <div  class="pure-u-1-2 gray-font">
    创建时间:&nbsp;<%=menu.getCreateDatetime().toString().substring(0,10) %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>最后修改:&nbsp;<%=menu.getAltDatetime().toString().substring(0,10) %>
    </div>
    <div  class="pure-u-1-2 align-right gray-font">
      
      


<div  class="bd-sharing pos-r">
<script>
// 把 _bd_share_main 设为 undefined 以再次执行 share.js
// 否则除第一次打开 dish popup 外，再打开 dish popup 时均无法初始化分享按钮
window._bd_share_main = undefined;
window._bd_share_config={
  "common":{
    "bdText": "\u83dc\u5355\u3010\u4e00\u4e2a\u670845\u8ba1\u5212\u3011",
    "bdDesc": "\u597d\u4e0d\u5bb9\u6613\u5230\u4e86\u52a0\u56fd\u81ea\u5df1\u505a\u996d\u7626\u4e86\u4e0b\u6765 \u6700\u8fd1\u51fa\u53bb\u5962\u4f88\u5403\u4e86\u51e0\u987f\u80c3\u96be\u53d7\u5f97\u7761\u4e0d\u7740\u89c9 \u63a5\u4e0b\u6765\u7684\u4e00\u4e2a\u6708 \u8981\u8ba9\u81ea\u5df1\u523045 \u6bcf\u5929\u4e00\u83dc\u4e00\u7ca5\u3002",
    "bdPic": "e78fba929ef311e38844b8ca3aeed2d7.jpg",
    "bdUrl": "/foodfood/AOHomePage..actionrecipe_list/101611479/",
  },
  "share":{
    "bdSize": "24",
  },
};

with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
</script>
</div>


    </div>
  </div>

</div>

<div  class="rl-recipes">
<%Set<FoodFoodMenuRelation>set=menu.getFoodFoodMenuRelations(); %>
  <div  class="block-title">
    &nbsp;<%=set.size() %>菜谱
  </div>
  <div  class="normal-recipe-list">
      <ul  class="plain">

      <%int i=0;
    int each=4;
   int size=set.size()/each;
   if(set.size()%each!=0)
    size++;
      for(FoodFoodMenuRelation ffmr:set){        
      if(i/each!=0){
     %>
     <li class="showfood<%=(i++/each)+1 %>" style="display:none">
     <%}else{ %>
  <li class="showfood<%=(i++/each)+1 %>">
    <%} %>
            <div  class="recipe-140-horizontal pure-g">
                <div  class="cover pure-u">
                    <a  href="/foodfood/AOFood.<%=ffmr.getFood().getFoodId() %>.action"  class="image-link">
                        <img  src="<%=ffmr.getFood().getImg()%>"  data-src="<%=ffmr.getFood().getImg() %>"  width="140"  height="106"  alt="<%=ffmr.getFood().getFoodName() %>"  class="unveiled">
                    </a>
                </div>
                <div  class="info pure-u">
                    <p  class="name">
                        <a  href="/foodfood/AOFood.<%=ffmr.getFood().getFoodId() %>.action"><%=ffmr.getFood().getFoodName() %></a>
                    </p>
                    <p  class="ing ellipsis">
                     <%Set<FoodMaterialFoodRelation> set2=ffmr.getFood().getFoodMaterialFoodRelations();
              String mflist="";
              for(FoodMaterialFoodRelation fmfr2:set2)
              {
                  mflist+=fmfr2.getMaterialFood().getMaterialFoodName()+"|";
              }
                int eachline=22;
                int j=mflist.length()/eachline;
                if(mflist.length()%eachline!=0)
                 j++;
                 for(int lines=0;lines<j;lines++)
                 {
                    if((lines+1)*eachline<mflist.length())
                       out.print(mflist.substring(lines*eachline,(lines+1)*eachline)+"<br>");
                    else
                     out.print(mflist.substring(lines*eachline,mflist.length()-1)+"<br>");
                 }
                 String str=ffmr.getFood().getEvaluation();
               String[] lists=str.split(",");
               double good=Double.parseDouble(lists[0]);
               double simple=Double.parseDouble(lists[1]);
               double bad=Double.parseDouble(lists[2]);
               double total=good+simple+bad;
               double percentsG=1;
               double percentsS=1;
               double percentsB=1;
               double grade=0;
               if(total!=0)
               {
                    percentsG=good/total;
                    percentsS=simple/total;
                    percentsB=bad/total;
                    grade=(40+60*percentsG+40*percentsS+30*percentsB);
                    grade=(double)((int)(grade*10))/10;
               }
               %>
                    </p>
                    <p  class="stats">
                        综合评分&nbsp;<span  class="score bold green-font"><%=grade %></span>&nbsp;
                    </p>
                    <p  class="author">
                       <%=ffmr.getFood().getUser().getNickName() %>
                    </p>
                    <p  class="reason">
                    </p>
                </div>
            </div>

          </li>
          
        <%} %>  
          
      </ul>
        <div  class="pager">
       <a id="pre" name="1" href="javascript:void(0)" onclick="toggle(this)">上一页</a><%for(i=0;i<size;i++){ if(i==0){%>
       <a name="<%=i+1 %>" href="javascript:void(0)" onclick="toggle(this)" class="now">
       <%}else{ %>
       <a name="<%=i+1 %>" href="javascript:void(0)" onclick="toggle(this)">
       <%} %>
       <%=i+1 %></a><%} %><a id="next" href="javascript:void(0)" name="1" onclick="toggle(this)">下一页</a>
  </div>
  </div>
</div>
</div>


          <div  id="main-panel-bottom"></div>
        </div>
        

        
        <div  class="pure-u-1-3 right-panel">
          
  


  

  

  
    <div  class="block block-has-padding white-bg">
      <div  class="title-bar">
        <div  class="title">流行菜单</div>
        <div  class="right-action"><a  href="/foodfood/AOFoodInMenuList..action">全部</a></div>
      </div>
      <ul  class="list">
      
          <%FoodMenuDAO dao7=new FoodMenuDAO();
                               List<FoodMenu> list7=dao7.findAll();
                               i=0;
                               for(FoodMenu fm:list7)
                               {
                                 if(i++==9)
                                 break;
                             %>
								<li><a
									href="/foodfood/AOFoodInMenu.<%=fm.getMenuId() %>.action"><span
										class="ellipsis"><%=fm.getMenuName() %></span>
								</a>
								</li>
								<%} %>
      </ul>
    </div>
  




  

  

<div  class="block">

<a  href="/foodfood/AOHomePage..actionrecipe_list/create/">创建一个新菜单</a><br><br>
<a  href="/foodfood/AOHomePage..actionrecipe_list/101611479/comments/"><%=menu.getMenuName() %>的留言（0）</a>
</div>


  
  <div  class="right-ad block">
      



<script  type="text/javascript">BAIDU_CLB_fillSlot("961619");</script>

  </div>
  

  

        </div>
        
      </div>
    
  </div>
  
</div>

<div  class="bottom-outer">
  <div  class="bottom-container">
   
  </div>
</div>




  
  <script  type="text/javascript"  src="./files/jquery.min.js"></script>
s
<script  type="text/javascript"  src="./files/2013.anonymous.0a0601dc.compress.js"></script><img  id="scrollTop"  src="./files/scroll_top.png"  style="opacity: 1; position: fixed; width: 50px; height: auto; z-index: 20; border: 0px; padding: 0px; bottom: 20px; right: 20px; margin: 0px; cursor: pointer; display: none;">


<div  id="color_timer"></div>





</body>
<script type="text/javascript">
    function toggle(t)
    {
       clickA=$(t);
       if(clickA.attr("id")=="next")
       {
          if($(".pager a[name="+(clickA.attr("name"))+"]").next().length!=0)
          {
              $(".pager a[name="+(parseInt(clickA.attr("name"))+1)+"]").click();
          }
       }
       else if(clickA.attr("id")=="pre")
       {
          if($(".pager a[name="+(clickA.attr("name"))+"]").prev().length!=0)
          {
              $(".pager a[name="+(parseInt(clickA.attr("name"))-1)+"]").click();
          }
       }
       else
       {
       clickA.attr("class","now");
       clickA.siblings().attr("class","");
       $(".showfood"+clickA.attr("name")).css("display","block");
       for(i=0;i<<%=size %>;i++)
       {
          if(i+1!=clickA.attr("name"))
            $(".showfood"+(i+1)).css("display","none");
       }
       $("#pre").attr("name",clickA.attr("name"));
       $("#next").attr("name",clickA.attr("name"));
       }
    }

</script>
</html>
